// The limits of ‘Western’ supply chain sustainability governance to halt deforestation
// Lead Author: Christoph Kubitza
//Email: Christoph.Kubitza@giga-hamburg.de
// Date: 02.9.2025


//Hansen

var geometry = ee.Geometry.Rectangle([113.975961, -9.038383, 141.473738, 4.481741 ]);
Map.addLayer(geometry, {});

var treeLoss = ee.Image('UMD/hansen/global_forest_change_2021_v1_9')
    .select('lossyear');

Export.image.toDrive({
  image: treeLoss ,
  description: 'treeLoss',
  crs: 'EPSG:4326',
  region: geometry,
maxPixels: 1e13
});

var forest = ee.Image('UMD/hansen/global_forest_change_2021_v1_9')
    .select('treecover2000');
Map.addLayer(forest, {max: 80}, 'forest cover 30 m');

Export.image.toDrive({
  image: forest ,
  description: 'treecover2000',
  crs: 'EPSG:4326',
  region: geometry,
maxPixels: 1e13
});

var canopyCover = ee.Image('UMD/hansen/global_forest_change_2021_v1_9')
    .select('treecover2000');
Map.addLayer(canopyCover, {max: 80}, 'forest cover 30 m');

// Canopy cover percentage (e.g. 10%).
var cc = ee.Number(10);

var canopyCover10 = canopyCover.gte(cc).selfMask();
Map.addLayer(canopyCover10, {max: 80}, 'forest cover10 30 m');

Export.image.toDrive({
  image: canopyCover10,
  description: 'canopyCover10',
  crs: 'EPSG:4326',
  region: geometry,
maxPixels: 1e13
});


//Danylo

var oil_palm = ee.Image("projects/sat-io/open-datasets/landcover/oil-palm-plantation-1984_2017/op_extent_age_05-0000093184-0000046592");
Map.addLayer(oil_palm, {max: 34}, 'op');

Export.image.toDrive({
  image: oil_palm,
  description: 'oilpalm8417',
  crs: 'EPSG:4326',
  region: geometry,
maxPixels: 1e13
});


//TMF

var geometry = ee.Geometry.Rectangle([113.975961, -9.038383, 141.473738, 4.481741 ]);
Map.addLayer(geometry, {});

//TMF layer of interest, for instance the "DegradationYear"
var DeforestationYear = ee.ImageCollection('projects/JRC/TMF/v1_2020/DeforestationYear').mosaic().clip(geometry);

// Export to google drive as GeoTIFF raster
Export.image.toDrive({
  image: DeforestationYear,
  description: 'JRC_TMF_DeforestationYear_ROI',
  scale: 30,
  region: geometry, 
  crs: 'EPSG:4326',
  maxPixels:1e13,
  fileFormat: 'GeoTIFF',
  formatOptions: {
    cloudOptimized: true
  }
});

//All other dataset can be delivered by authors on request and are publicly available s